function quickSort(arr) {//快速排序
    if (arr.length <= 1) return arr;
    let midIndex = Math.floor(arr.length / 2);
    let pivot = arr.splice(midIndex, 1)[0];
    let left = [];
    let right = [];
    for (let i = 0; i < arr.length; i++) {
      if (arr[i] < pivot) {
        left.push(arr[i]);
      } else {
        right.push(arr[i]);
      }
    }
    return quickSort(left).concat([pivot], quickSort(right));
  }
  
  function insertSort(arr) {
    //插⼊排序
    if (arr.length <= 1) return arr;
    var len = arr.length;
    for (var i = 1; i < len; i++) {
      var temp = arr[i];
      var j = i - 1; //默认已排序的元素
      while (j >= 0 && arr[j] > temp) {
        arr[j + 1] = arr[j]; 
        j--;
      }
      arr[j + 1] = temp;
    }
    return arr;
  }